package com.ase.删除奇数10000;

import java.util.ArrayList;
import java.util.Iterator;

/**
 * @author gyhstart
 * @create 2021/2/18 - 9:35
 **/
public class Onejishu {
    public static void main(String[] args) {
        // 创建集合
        ArrayList<Integer> list = new ArrayList<>();
        for (int i = 1; i <= 10000; i++) {
            list.add(i);
        }

        ArrayList<Integer> list2 = new ArrayList<>();

        Iterator it = list.iterator();
        while (it.hasNext()) {
            Integer integer = (Integer) it.next();
            if (integer % 2 == 0){
                list2.add(integer);
            }
        }

        System.out.println(list2);
    }
}
